package com.example.gulimall.auth;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

/**
 * 认证服务启动类
 *  1.使用 @EnableDiscoveryClient 注解开启服务注册与发现功能
 *  2.使用@EnableFeignClients开启远程调用
 *  3.使用@EnableRedisHttpSession 开启session会话共享
 * 核心原理
 *   1。@EnableRedisHttpSession导入RedisHttpSessionConfiguration配置，给容器中添加了一个组件
 *   2.RedisOperationsSessionRepository：Redis操作session，session的增删改查封装类
 *   3，sessionRepositoryFilter
 *     原生的获取session时是通过HttpServletRequest获取的
 *     这里对request进行包装，并且重写了包装request的getSession()方法
 * @author GuLin
 * @date 22:41 2021/6/28
 **/
@EnableRedisHttpSession
@EnableDiscoveryClient
@EnableFeignClients(value = "com.example.gulimall.auth.feign")
@SpringBootApplication
public class GulimallAuthServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(GulimallAuthServerApplication.class, args);
    }

}
